import com.zhs.study.*;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class AppMain {

    public static void main(String[] args) {
    	//扩展，用于鉴定属性
//		MyClassPathXmlApplicationContext m = new MyClassPathXmlApplicationContext("classpath:spring.xml");
//        ClassPathXmlApplicationContext ioc=new ClassPathXmlApplicationContext("classpath:spring.xml");
//        //生成其他类
//		Teacher teacher = (Teacher) ioc.getBean("people");
//		System.out.println("学生的姓名为:" + teacher.getUsername());    // 获得被Factory修饰后的getobject返回的对象
//
//		//生成当前类
//		People people = (People) ioc.getBean("&people");
//		System.out.println("当前值为people..." + people.getUsername());    // 获得被Factory修饰后的getobject返回的对象

		//获取注解类
		ApplicationContext ac = new AnnotationConfigApplicationContext(AnnotationConfig.class);
		User user = (User)ac.getBean("user");
		System.out.println(user.getUsername());
	}

}
